package com.enba.mallapi.module.auth.controller.resp;

import com.enba.boot.core.utils.TreeNode;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "权限树形表格节点响应类")
@Data
public class MenuTreeTableNodeResp extends TreeNode {

  public MenuTreeTableNodeResp(Long id, Long parentId, String name) {
    super(id, parentId, name);
    this.name = name;
  }

  private Integer type;

  private String name;

  private String perms;

  private String url;

  private String icon;

  private Integer status;

  @ApiModelProperty("是否父节点")
  private Boolean isParent;

  public Boolean getIsParent() {
    return getChildren().size() > 0;
  }

  // true:选中 false:未选中
  @JsonIgnore private boolean layChecked;

  public void setLayChecked(boolean layChecked) {
    this.layChecked = layChecked;
  }

  @JsonGetter("LAY_CHECKED")
  public boolean getLAY_CHECKED() {
    return layChecked;
  }
}
